<?php

use Overtrue\Pinyin\Pinyin;
use Godruoyi\Snowflake\Snowflake;

function getPinyinStr(array $tags)
{
    $temp = [];
    $py = new Pinyin();
    foreach ($tags as $tag) {
        $temp[] = $py->permalink($tag, '_');
    }
    return implode(".", $temp);
}


/**
 * 雪花ID
 */
function uqId()
{
    $snowflake = new Snowflake();
    $date = '2022-01-01'; // 根据项目开始时间调整
    $snowflake->setStartTimeStamp(strtotime($date) * 1000);
    return $snowflake->id();
}
